//
//  BuyRecommendCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/16.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "BuyRecommendCell.h"
@interface BuyRecommendCell ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomMargin;
@property (weak, nonatomic) IBOutlet UILabel *ToptitleLabel;
@property (weak, nonatomic) IBOutlet UIButton *bottomBtn;
@property (weak, nonatomic) IBOutlet UILabel *secendLabel;
@property (weak, nonatomic) IBOutlet UILabel *thirdLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightImageView;
@property (weak, nonatomic) IBOutlet UIView *markView;

@end

@implementation BuyRecommendCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.contentView.backgroundColor = viewBgGrey;
    
    
    self.markView.backgroundColor = colorWith(35, 122, 217);
    
    self.markView.layer.cornerRadius = 1;
    
    self.markView.layer.masksToBounds = YES;
    
    
    self.bottomMargin.constant = 0;
    
    self.ToptitleLabel.font = MYFONT(16);
    
//    self.ToptitleLabel.textColor = colorWith(242, 83, 55);
    
    self.secendLabel.font = MYFONT(17);
    
    self.thirdLabel.font = MYFONT(15);
    
    self.thirdLabel.textColor = darkGray;
    
    self.bottomBtn.layer.borderColor = colorWith(23, 78, 241).CGColor;
    self.bottomBtn.layer.borderWidth = 0.6;
    self.bottomBtn.layer.cornerRadius = 17;
    
    [self.bottomBtn setTitleColor:colorWith(23, 78, 241) forState:UIControlStateNormal];
    [self.bottomBtn setTitleColor:colorWith(23, 78, 241) forState:UIControlStateHighlighted];
    
    self.bottomBtn.titleLabel.font = MYFONT(16);

}


- (void)setModel:(HomeSubModel *)model{
    _model = model;
    
    [self.rightImageView sd_setImageWithURL:[NSURL URLWithString:_model.pic_cover_small] placeholderImage:nil];
    
    self.secendLabel.text = _model.goods_name;
    
    self.thirdLabel.text = _model.descrip;
    
    
//    NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[_model.descrip dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType ,NSFontAttributeName : [UIFont systemFontOfSize:14]} documentAttributes:nil error:nil];
//
//    self.thirdLabel.attributedText = attrStr;
//
    
}
- (IBAction)btnDidTap:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(recommendCellDidClickWith:)]) {
        [self.delegate recommendCellDidClickWith:self.model];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
